const {addressFormatError} = require("../constant/error")
const validator = (rules) => {
    return async (ctx, next) => {
        try {
            ctx.verifyParams(rules);
        } catch (err) {
            console.error(err);
            return ctx.app.emit('error', addressFormatError, ctx);
        }
        await next();
    }
}
module.exports = {
    validator
}